<template>
  <div class="images-text-com">
    <div v-show="showDelete" class="list-item-delete  " style="font-size:16px;">
      <span class="pull_left">{{ item.text }}</span>
      <span class="pull_right" @click.stop="deleteCurItem(item, index)"
        >删除</span
      >
    </div>
    <div v-if="item.stylesType == 0" class="styleOne  ">
      <p>{{ item.imgUrls[0].title || "这里是标题" }}</p>
      <span>{{ item.imgUrls[0].substance || "内容" }}</span>
      <div class="imgbox">
        <img v-if="item.imgUrls[0].src" :src="item.imgUrls[0].src" />
        <img v-else src="http://oss.ztwlxx.cn/1.3.png" />
      </div>
    </div>
    <div v-if="item.stylesType == 1" class="styleTwo  ">
      <div class="imgbox">
        <img v-if="item.imgUrls[0].src" :src="item.imgUrls[0].src" />
        <img v-else src="http://oss.ztwlxx.cn/1.2.png" />
      </div>
      <div>
        <p>{{ item.imgUrls[0].title || "这里是标题" }}</p>
        <span>{{ item.imgUrls[0].substance || "内容" }}</span>
      </div>
    </div>
    <div v-if="item.stylesType == 2" class="styleThree  ">
      <div class="imgbox">
        <img v-if="item.imgUrls[0].src" :src="item.imgUrls[0].src" />
        <img v-else src="http://oss.ztwlxx.cn/1.2.png" />
      </div>
      <div>
        <p>{{ item.imgUrls[0].title || "这里是标题" }}</p>
        <span>{{ item.imgUrls[0].substance || "内容" }}</span>
      </div>
    </div>
    <div v-if="item.stylesType == 3" class="styleFour  ">
      <div class="item">
        <div class="imgbox">
          <img v-if="item.imgUrls[0].src" :src="item.imgUrls[0].src" />
          <img v-else src="http://oss.ztwlxx.cn/1.2.png" />
        </div>
        <p>{{ item.imgUrls[0].title || "这里是标题" }}</p>
        <span>{{
          item.imgUrls[0].substance ||
            "商品名称商品名称商品名称商品名称商品名称"
        }}</span>
      </div>
      <div class="item">
        <div class="imgbox">
          <img v-if="item.imgUrls[1].src" :src="item.imgUrls[1].src" />
          <img v-else src="http://oss.ztwlxx.cn/1.2.png" />
        </div>
        <p>{{ item.imgUrls[1].title || "这里是标题" }}</p>
        <span>{{
          item.imgUrls[1].substance ||
            "商品名称商品名称商品名称商品名称商品名称"
        }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
      default: () => {}
    },
    index: {
      type: Number,
      default: -1
    },
    showDelete: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    deleteCurItem(e, i) {
      this.$emit("deleteCurItem", e, i);
    }
  }
};
</script>

<style lang="scss" scoped>
.images-text-com {
  position: relative;
  padding: 10px;
  background-color: #fff;
  font-size: 12px;
  .imgbox,
  img {
    border-radius: 6px;
  }
  .styleOne {
    font-size: 16px;
    line-height: 24px;
    p {
      color: #595961;
    }
    span {
      color: #999999;
    }
    .imgbox {
      width: 100%;
      height: 185px;
      overflow: hidden;
      margin: 15px 0;
      img {
        width: 100%;
        height: 100%;
      }
    }
  }
  .styleTwo {
    height: 92px;
    .imgbox {
      width: 170px;
      height: 90px;
      float: left;
      margin-right: 10px;
      overflow: hidden;
      border-radius: 6px;
      margin: 0 10px 10px 0;
      img {
        width: 100%;
        height: 100%;
      }
    }
    p {
      padding-top: 4px;
      line-height: 20px;
    }
    span {
      color: #999999;
      display: block;
      line-height: 18px;
      padding-right: 40px;
    }
  }
  .styleThree {
    text-align: right;
    height: 92px;
    .imgbox {
      width: 170px;
      height: 90px;
      float: right;
      margin-left: 10px;
      overflow: hidden;
      margin: 0 0 10px 10px;
      img {
        width: 100%;
        height: 100%;
      }
    }
    p {
      padding-top: 4px;
      line-height: 20px;
    }
    span {
      color: #999999;
      padding-left: 40px;
    }
  }
  .styleFour {
    display: flex;
    .item {
      width: 50%;
      .imgbox {
        width: 170px;
        height: 90px;
        overflow: hidden;
        margin-bottom: 10px;
        img {
          width: 100%;
          height: 100%;
        }
      }

      span {
        color: #999999;
      }
      p {
        padding-top: 10px;
      }
    }
    .item:first-child {
      padding-right: 10px;
    }
    .item:last-child {
      padding-left: 10px;
    }
  }
}
</style>
